package cn.tedu.egmybatis1.mapper;

import entity.Egmy;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;


@Mapper
public interface EgmyMapper {
    @Insert("INTSERT INTO mybatisdb.product(id,title,price,stock) VALUES (#{id},#{title},#{price},#{stock})")
    int insertProduct(Egmy egmy);


    @Select("SELECT title ,price FROM mybatisdb.product WHERE id=#{id} ")
     Egmy selectSingleProduct(int id);

    @Delete("DELETE FROM mybatisdb.product WHERE id=#{id} ")
    Egmy eleteById(int id);

    @Select("SELECT title, stock FROM mybatisdb.product" )
    List<Egmy>  selectManyProduct();






















}
